#pragma once
#include <Windows.h>
#include <tchar.h>
#include "SDLComponent.h"
#include "SDL.h"

class SDLEngine
{
public:
	static SDLEngine* GetInstance()
	{
		if(instance == 0)
		{
			instance = new SDLEngine();
		}
		return instance;
	}

	static void Kill()
	{
		delete instance;
		instance = 0;
		SDL_Quit();
	}

	SDL_Surface* GetScreen(){ return screen; }

	void Start();
	void Start(const bool debugMode);
	void Start(const int screenWidth, const int screenHeight);
	void Start(const int screenWidth, const int screenHeight, const bool debugMode);
	void Run();
	void Update();
	void Draw();
	
private:
	// Singleton
	SDLEngine();
	~SDLEngine();
	static SDLEngine* instance;
	SDLEngine& operator= (const SDLEngine&);

	// constantes
	static const int SCREEN_WIDTH = 800;
	static const int SCREEN_HEIGHT = 600;
	static const int SCREEN_BPP = 32;

	// Variables
	SDL_Surface* screen;
	SDL_Event event;
	bool quit;

	// Private Methods
	void Initialise(const int width = SCREEN_WIDTH, const int height = SCREEN_HEIGHT, const bool debugMode = false);

};

